import numpy as np#计算股票涨跌率
b= np.array((10,9.5,10.2,11,10.8,10.6,11.2))
np.diff(b)

ret = np.diff(b)/b[:-1]
print('涨跌率{}'.format(ret))

np.where(ret>0.02)